package com.geek.jdbc.trans.customers;

/**
 * @author zhoujunjie
 * @desc TODO
 * @date
 */
import com.geek.jdbc.utils.JDBCUtil;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class QueryAllCustomers {
    public static void main(String[] args) {
        String sql = "SELECT * FROM customers";
        try (Connection conn = JDBCUtil.getConnection();
             Statement stmt = conn.createStatement();
             ResultSet rs = stmt.executeQuery(sql)) {
            while (rs.next()) {
                int id = rs.getInt("id");
                String name = rs.getString("name");
                String email = rs.getString("email");
                java.sql.Date birthday = rs.getDate("birthday");
                System.out.println(id + " " + name + " " + email + " " + birthday);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}